package com.fcx.workai.loginmodule.ui;

import android.os.Bundle;

import com.alibaba.android.arouter.facade.annotation.Route;
import com.fcx.workai.loginmodule.R;
import com.fcx.workai.loginmodule.ui.login.PwdLoginFragment;
import com.fcx.workai.loginmodule.ui.setpwd.SetPwdFragment;
import com.fcx.workai.loginmodule.ui.smslogin.SMSLoginFragment;
import com.hxh.component.basicore.component.mvp.view.BaseActivity;
import com.hxh.component.business.arouter.provider.ILoginActivityProvider;
import com.hxh.component.business.utils.Constant;

import me.yokeyword.fragmentation.anim.DefaultHorizontalAnimator;
import me.yokeyword.fragmentation.anim.FragmentAnimator;


@Route(path = ILoginActivityProvider.KEY)
public class LoginMainActivity extends BaseActivity {
    public String mShowTag = Constant.RouterTag.LOGIN_SHOWTYPE_LOGIN;

    //当前步骤
    public static final String BUNDLE_VERIFY_STEP = "verify_step";
    //失败原因
    public static final String BUNDLE_FAIL_REASON = "fail_reason";

    private int mStep;
    private String mFailReason;

    @Override
    public int getLayoutId() {
        return R.layout.activity_main_login;
    }

    @Override
    public void initData(Bundle saveInstanceState) {

        mShowTag = getExtra_String(Constant.RouterTag.SHOWTAG);
        mStep = getExtra_Int(BUNDLE_VERIFY_STEP,1);
        mFailReason = getExtra_String(BUNDLE_FAIL_REASON);

        if (mShowTag.equals(Constant.RouterTag.LOGIN_SHOWTYPE_LOGIN)) {
            loadRootFragment(R.id.frame_main_main, PwdLoginFragment.newInstance());
        } else if (mShowTag.equals(Constant.RouterTag.LOGIN_SHOWTYPE_SMSLOGIN)) {
            loadRootFragment(R.id.frame_main_main, SMSLoginFragment.newInstance());
        } else if (mShowTag.equals(Constant.RouterTag.LOGIN_SHOWTYPE_SETPWD)) {
            loadRootFragment(R.id.frame_main_main, SetPwdFragment.newInstance());
        }
    }

    @Override
    public FragmentAnimator onCreateFragmentAnimator() {
        return new DefaultHorizontalAnimator();
    }


    @Override
    public com.hxh.component.basicore.component.mvp.persenter.IPresenter newP() {
        return null;
    }
}
